package o;

import android.annotation.TargetApi;
import android.media.MediaFormat;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.video.ColorInfo;
import com.huawei.appgallery.festivalanimation.particle.modifiers.SizeModifier;
import java.nio.ByteBuffer;
import java.util.List;

@TargetApi(16)
public final class ahc {
    public static void ˊ(MediaFormat mediaFormat, List<byte[]> list) {
        for (int i = 0; i < list.size(); i++) {
            mediaFormat.setByteBuffer("csd-" + i, ByteBuffer.wrap((byte[]) list.get(i)));
        }
    }

    public static void ˋ(MediaFormat mediaFormat, String str, int i) {
        if (i != -1) {
            mediaFormat.setInteger(str, i);
        }
    }

    public static void ˎ(MediaFormat mediaFormat, String str, float f) {
        if (f != SizeModifier.STABLE_STATE_SCALE) {
            mediaFormat.setFloat(str, f);
        }
    }

    public static void ˎ(MediaFormat mediaFormat, String str, @Nullable byte[] bArr) {
        if (bArr != null) {
            mediaFormat.setByteBuffer(str, ByteBuffer.wrap(bArr));
        }
    }

    public static void ˊ(MediaFormat mediaFormat, @Nullable ColorInfo colorInfo) {
        if (colorInfo != null) {
            ˋ(mediaFormat, "color-transfer", colorInfo.ˋ);
            ˋ(mediaFormat, "color-standard", colorInfo.ˎ);
            ˋ(mediaFormat, "color-range", colorInfo.ˊ);
            ˎ(mediaFormat, "hdr-static-info", colorInfo.ˏ);
        }
    }
}
